package com.github.jspxnet.worktask.model.enums;

import com.github.jspxnet.enums.EnumType;

public enum GatewayEnumType implements EnumType {

    /////////网关 begin
    //控制同步
    JOIN(2, "join","合并节点"),

    //分支节点
    FORK(1, "fork","分支节点"),

    /////////网关 end
    //标识不是分支节点
    NONE(0, "none","无");

    private final int value;
    private final String code;
    private final String name;

    GatewayEnumType(int value, String code,String name) {
        this.value = value;
        this.code = code;
        this.name = name;
    }

    static public GatewayEnumType find(int value) {
        for (GatewayEnumType c : GatewayEnumType.values()) {
            if (c.value == value) {
                return c;
            }
        }
        return GatewayEnumType.FORK;
    }

    static public GatewayEnumType find(String code) {
        for (GatewayEnumType c : GatewayEnumType.values()) {
            if (c.code.equalsIgnoreCase(code)) {
                return c;
            }
        }
        return GatewayEnumType.FORK;
    }

    @Override
    public int getValue() {
        return this.value;
    }

    @Override
    public String getName() {
        return this.name;
    }

}
